package com.heima.admin.controller;

import com.heima.feign.wemedia.WemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/channel")
public class ChannelController {

    @Autowired
    private WemediaClient wemediaClient;

    /**
     * 自媒体端,频道列表查询
     */
    @GetMapping("/channels")
    public ResponseResult<List<WmChannel>> channelList() {
        ResponseResult<List<WmChannel>> response = wemediaClient.channelList();
        List<WmChannel> wmChannels = response.getData();
        return ResponseResult.okResult(wmChannels);
    }
}
